.class public Lcom/example/location/TextChange;
.super Landroid/widget/TextView;
.source "TextChange.java"


# instance fields
.field private contentText:Ljava/lang/String;

.field private handler:Landroid/os/Handler;

.field private isOne:Z

.field private list:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attrs"    # Landroid/util/AttributeSet;

    .prologue
    .line 22
    invoke-direct {p0, p1, p2}, Landroid/widget/TextView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 23
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    .line 24
    new-instance v0, Lcom/example/location/TextChange$1;

    invoke-direct {v0, p0}, Lcom/example/location/TextChange$1;-><init>(Lcom/example/location/TextChange;)V

    iput-object v0, p0, Lcom/example/location/TextChange;->handler:Landroid/os/Handler;

    .line 44
    return-void
.end method

.method static synthetic access$0(Lcom/example/location/TextChange;)Ljava/util/List;
    .locals 1

    .prologue
    .line 16
    iget-object v0, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    return-object v0
.end method

.method static synthetic access$1(Lcom/example/location/TextChange;)Landroid/os/Handler;
    .locals 1

    .prologue
    .line 18
    iget-object v0, p0, Lcom/example/location/TextChange;->handler:Landroid/os/Handler;

    return-object v0
.end method

.method private segmentationTxt()V
    .locals 9

    .prologue
    const/4 v8, 0x0

    .line 102
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getVisibility()I

    move-result v5

    const/16 v6, 0x8

    if-eq v5, v6, :cond_0

    invoke-virtual {p0}, Lcom/example/location/TextChange;->getText()Ljava/lang/CharSequence;

    move-result-object v5

    if-eqz v5, :cond_0

    .line 103
    const-string v5, ""

    invoke-virtual {p0}, Lcom/example/location/TextChange;->getText()Ljava/lang/CharSequence;

    move-result-object v6

    invoke-interface {v6}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-eqz v5, :cond_1

    .line 133
    :cond_0
    :goto_0
    return-void

    .line 106
    :cond_1
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getText()Ljava/lang/CharSequence;

    move-result-object v5

    invoke-interface {v5}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v4

    .line 108
    .local v4, "txt":Ljava/lang/String;
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getLayout()Landroid/text/Layout;

    move-result-object v5

    invoke-virtual {v5, v8}, Landroid/text/Layout;->getLineEnd(I)I

    move-result v5

    add-int/lit8 v0, v5, 0x1

    .line 110
    .local v0, "characterTotalLength":I
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getLayout()Landroid/text/Layout;

    move-result-object v5

    invoke-virtual {v5, v8}, Landroid/text/Layout;->getEllipsisStart(I)I

    move-result v5

    add-int/lit8 v1, v5, 0x1

    .line 111
    .local v1, "characterVisibleLength":I
    const-string v5, "huoying"

    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "getLayout().getEllipsisStart(0):"

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 112
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getLayout()Landroid/text/Layout;

    move-result-object v7

    invoke-virtual {v7, v8}, Landroid/text/Layout;->getEllipsisStart(I)I

    move-result v7

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    .line 111
    invoke-static {v5, v6}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 113
    const-string v5, "huoying"

    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "lineShijiCount:"

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v6, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 115
    rem-int v5, v0, v1

    if-nez v5, :cond_2

    .line 116
    div-int v3, v0, v1

    .line 118
    .local v3, "linehang":I
    :goto_1
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_2
    if-lt v2, v3, :cond_3

    .line 127
    iget-object v5, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    invoke-interface {v5}, Ljava/util/List;->size()I

    move-result v5

    if-lez v5, :cond_0

    .line 128
    iget-object v5, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    invoke-interface {v5, v8}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Ljava/lang/CharSequence;

    invoke-virtual {p0, v5}, Lcom/example/location/TextChange;->setText(Ljava/lang/CharSequence;)V

    .line 129
    iget-object v5, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    invoke-interface {v5}, Ljava/util/List;->size()I

    move-result v5

    const/4 v6, 0x1

    if-le v5, v6, :cond_0

    .line 130
    iget-object v5, p0, Lcom/example/location/TextChange;->handler:Landroid/os/Handler;

    const-wide/16 v6, 0x9c4

    invoke-virtual {v5, v8, v6, v7}, Landroid/os/Handler;->sendEmptyMessageDelayed(IJ)Z

    goto :goto_0

    .line 117
    .end local v2    # "i":I
    .end local v3    # "linehang":I
    :cond_2
    div-int v5, v0, v1

    add-int/lit8 v3, v5, 0x1

    goto :goto_1

    .line 119
    .restart local v2    # "i":I
    .restart local v3    # "linehang":I
    :cond_3
    mul-int v5, v2, v1

    add-int/2addr v5, v1

    add-int/lit8 v6, v0, -0x1

    if-le v5, v6, :cond_4

    .line 120
    iget-object v5, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    mul-int v6, v2, v1

    .line 121
    add-int/lit8 v7, v0, -0x1

    .line 120
    invoke-virtual {v4, v6, v7}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v6

    invoke-interface {v5, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 118
    :goto_3
    add-int/lit8 v2, v2, 0x1

    goto :goto_2

    .line 123
    :cond_4
    iget-object v5, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    mul-int v6, v2, v1

    .line 124
    mul-int v7, v2, v1

    add-int/2addr v7, v1

    .line 123
    invoke-virtual {v4, v6, v7}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v6

    invoke-interface {v5, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_3
.end method

.method private setTheContent()V
    .locals 5

    .prologue
    const/4 v4, 0x0

    .line 71
    const/4 v0, 0x0

    .local v0, "content":Ljava/lang/String;
    iget-object v1, p0, Lcom/example/location/TextChange;->contentText:Ljava/lang/String;

    invoke-direct {p0, v1}, Lcom/example/location/TextChange;->subStringContent(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 72
    iget-object v1, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v1

    if-lez v1, :cond_0

    iget-object v1, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    invoke-interface {v1, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/CharSequence;

    invoke-virtual {p0, v1}, Lcom/example/location/TextChange;->setText(Ljava/lang/CharSequence;)V

    iget-object v1, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v1

    const/4 v2, 0x1

    if-le v1, v2, :cond_0

    .line 73
    iget-object v1, p0, Lcom/example/location/TextChange;->handler:Landroid/os/Handler;

    const-wide/16 v2, 0xbb8

    invoke-virtual {v1, v4, v2, v3}, Landroid/os/Handler;->sendEmptyMessageDelayed(IJ)Z

    :cond_0
    return-void
.end method

.method private subStringContent(Ljava/lang/String;)Ljava/lang/String;
    .locals 9
    .param p1, "content"    # Ljava/lang/String;

    .prologue
    .line 84
    const/4 v2, 0x0

    .line 85
    .local v2, "h":Ljava/lang/String;
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getPaint()Landroid/text/TextPaint;

    move-result-object v6

    invoke-virtual {v6, p1}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v5

    .local v5, "width":F
    const-string v6, "huoying"

    .line 86
    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, " content.length:"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    .line 85
    invoke-static {v6, v7}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 88
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getMeasuredWidth()I

    move-result v6

    int-to-float v6, v6

    cmpl-float v6, v5, v6

    if-lez v6, :cond_2

    invoke-virtual {p1}, Ljava/lang/String;->toCharArray()[C

    move-result-object v0

    .line 89
    .local v0, "c":[C
    const/4 v3, 0x0

    .local v3, "h1":F
    const/4 v4, 0x0

    .local v4, "i":I
    :goto_0
    array-length v6, v0

    if-lt v4, v6, :cond_0

    .line 94
    .end local v0    # "c":[C
    .end local v3    # "h1":F
    .end local v4    # "i":I
    :goto_1
    return-object v2

    .line 90
    .restart local v0    # "c":[C
    .restart local v3    # "h1":F
    .restart local v4    # "i":I
    :cond_0
    aget-char v6, v0, v4

    invoke-static {v6}, Ljava/lang/String;->valueOf(C)Ljava/lang/String;

    move-result-object v1

    .local v1, "c1":Ljava/lang/String;
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getPaint()Landroid/text/TextPaint;

    move-result-object v6

    invoke-virtual {v6, v1}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v6

    add-float/2addr v3, v6

    .line 91
    invoke-virtual {p0}, Lcom/example/location/TextChange;->getMeasuredWidth()I

    move-result v6

    int-to-float v6, v6

    cmpl-float v6, v3, v6

    if-ltz v6, :cond_1

    const/4 v6, 0x0

    add-int/lit8 v7, v4, -0x1

    invoke-virtual {p1, v6, v7}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v2

    iget-object v6, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    invoke-interface {v6, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 92
    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v6

    add-int/lit8 v6, v6, -0x1

    invoke-virtual {p1, v4, v6}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v6

    invoke-direct {p0, v6}, Lcom/example/location/TextChange;->subStringContent(Ljava/lang/String;)Ljava/lang/String;

    .line 93
    const-string v6, "huoying"

    const-string v7, "hahah"

    invoke-static {v6, v7}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    .line 89
    :cond_1
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .line 93
    .end local v0    # "c":[C
    .end local v1    # "c1":Ljava/lang/String;
    .end local v3    # "h1":F
    .end local v4    # "i":I
    :cond_2
    iget-object v6, p0, Lcom/example/location/TextChange;->list:Ljava/util/List;

    invoke-interface {v6, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_1
.end method


# virtual methods
.method protected onLayout(ZIIII)V
    .locals 3
    .param p1, "changed"    # Z
    .param p2, "left"    # I
    .param p3, "top"    # I
    .param p4, "right"    # I
    .param p5, "bottom"    # I

    .prologue
    const/4 v2, 0x1

    .line 50
    invoke-super/range {p0 .. p5}, Landroid/widget/TextView;->onLayout(ZIIII)V

    .line 51
    iget-boolean v0, p0, Lcom/example/location/TextChange;->isOne:Z

    if-nez v0, :cond_0

    .line 55
    iput-boolean v2, p0, Lcom/example/location/TextChange;->isOne:Z

    .line 57
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {p0}, Lcom/example/location/TextChange;->getText()Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/example/location/TextChange;->contentText:Ljava/lang/String;

    .line 58
    invoke-direct {p0}, Lcom/example/location/TextChange;->setTheContent()V

    .line 60
    iput-boolean v2, p0, Lcom/example/location/TextChange;->isOne:Z

    .line 63
    :cond_0
    return-void
.end method
